//
//  YJcategoryBelowView.m
//  SnackCourier
//
//  Created by qianfeng01 on 15/7/23.
//  Copyright (c) 2015年 qianfeng01. All rights reserved.
//

#import "YJcategoryBelowView.h"
#import "UIImageView+WebCache.h"

@interface YJcategoryBelowView ()

@property (nonatomic,weak)id target;
@property (nonatomic,assign)SEL action;

@end

@implementation YJcategoryBelowView

-(void)addTarget:(id)target action:(SEL)action{
    self.target=target;
    self.action =action;
}

-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
    //忽略SEL 产生的警告
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
    if ([self.target respondsToSelector:self.action]) {
        [self.target performSelector:self.action withObject:self];
    }
#pragma clang diagnostic pop
}

-(void)showDataWithModel:(YJcategoryBelowModel *)model{
    [self.imgUrlView sd_setImageWithURL:[NSURL URLWithString:model.imgUrl]];
    self.titleLabel.text =model.title;
    self.priceStrLabel.text =[NSString stringWithFormat:@"￥%@",model.priceStr];
    if (model.originalPriceStr.length!=0) {
        self.originalPriceStr.text =[NSString stringWithFormat:@"￥%@",model.originalPriceStr];
    }else{
        self.originalPriceStr.text =@"";
    }
    
    
    
}
@end
